// 引入库 安装到Vue 中
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)

// 引入 element 语言库
import elementZH from 'element-ui/lib/locale/lang/zh-CN'
import elementEN from 'element-ui/lib/locale/lang/en'

// 引入菜单语言包
import customZH from './zh'
import customEN from './en'

// 创建实例
export default new VueI18n({
  locale: localStorage.getItem('lang') || 'zh',
  messages: {
    zh: {
      morning: '早安!',
      goodDay: '祝你开心每一天',
      setLang: '恭喜设置语言成功',
      ...elementZH,
      ...customZH
    },
    en: {
      morning: 'Good Morning!',
      goodDay: 'have a good day',
      setLang: 'Congratulation, change language successfully',
      ...elementEN,
      ...customEN
    }
  }
})
